// 物联网--》设备分组
import http from './http';

// 获取列表数据
const list = (pageNum = 1, pageSize = 10) => {
  return http.get('/iot/group/list', {
    params: {
      pageNum,
      pageSize
    }
  });
};

// 搜索功能 获取列表数据
const listSearch = (pageNum = 1, pageSize = 10, groupName) => {
  return http.get('/iot/group/list', {
    params: {
      pageNum,
      pageSize,
      groupName
    }
  });
};

// 获取选择分组列表数据
const listByGroup = (pageNum = 1, pageSize = 10,userId) => {
  return http.get('/iot/device/listByGroup', {
    params: {
      pageNum,
      pageSize,
      userId
    }
  });
};

// 搜索功能 获取选择分组列表数据 弹框
const listByGroupSearch = (pageNum = 1, pageSize = 10, userId, deviceName) => {
  return http.get('/iot/device/listByGroup', {
    params: {
      pageNum,
      pageSize,
      userId,
      deviceName
    }
  });
};

// 获取xxx数据
const iot_device_status = () => {
  return http.get('/system/dict/data/type/iot_device_status');
};

// 新增设备分组
const groupAdd = (data) => {
  return http.post('/iot/group', data)
}

// 修改设备分组
const groupUpdate = (data) => {
  return http.put('/iot/group', data)
}

export default {
  list,
  listSearch,
  iot_device_status,
  groupAdd,
  groupUpdate,
  listByGroup,
  listByGroupSearch
}